﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.FlowNode.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.Api
{
    [ApiRouteName("/flow/node/{name}")]
    internal class FlowNodeApi : ApiController
    {
        private readonly IFlowNodeService _Service;

        public FlowNodeApi ( IFlowNodeService service )
        {
            this._Service = service;
        }
        public bool SetBeginNode ( LongParam<BeginNodeSet> obj )
        {
            return this._Service.SetBeginNode(obj.Id, obj.Value);
        }
        public bool SetForm ( LongParam<FlowNodeForm> obj )
        {
            return this._Service.SetForm(obj.Id, obj.Value);
        }
        public long Add ( FlowNodeAdd data )
        {
            return this._Service.Add(data);
        }
        public bool SetIntoOut ( LongParam<FlowNodeIntoOut> data )
        {
            return this._Service.SetIntoOut(data.Id, data.Value);
        }

        public void Delete ( [NumValidate("flow.node.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public FlowNodeDto Get ( [NumValidate("flow.node.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }

        public FlowNodeBase[] Gets ( [NumValidate("flow.id.error", 1)] long flowId )
        {
            return this._Service.Gets(flowId);
        }
        public void SetCoordinate ( LongParam<ImgPoint> set )
        {
            this._Service.SetCoordinate(set.Id, set.Value);
        }
        public bool Set ( LongParam<FlowNodeSet> set )
        {
            return this._Service.Set(set.Id, set.Value);
        }
    }
}
